package com.atguigu.petstore.shop.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 商城-分类
 * @TableName shop_category
 */
@TableName(value ="shop_category")
@Data
public class ShopCategory implements Serializable {
    /**
     * 
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 分类名
     */
    @TableField(value = "cate_name")
    private String cateName;

    /**
     * 分类图
     */
    @TableField(value = "cate_img")
    private String cateImg;

    /**
     * 父类id
     */
    @JsonProperty("pId")
    @TableField(value = "p_id")
    private Long pId;

    /**
     * 排序数字
     */
    @TableField(value = "sort_num")
    private Integer sortNum;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    //子分类，构建树用的
    @TableField(exist = false)
    private List<ShopCategory> children;


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", cateName=").append(cateName);
        sb.append(", cateImg=").append(cateImg);
        sb.append(", pId=").append(pId);
        sb.append(", sortNum=").append(sortNum);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}